How to Use Parameters or Variables in a Query Expression

Description

A variable and a parameter are the same thing. A parameter is just an Alpha Anywhere variable whose value is prompted for at run-time.

To use a variable (or a parameter) in a filter or an order expression, prefix the variable name (or parameter name) with: VAR-> For example, the following filter expressions use variables:

between(invoice_date, var->start_date, var->end_date)
state = var->which_state
(state = var->which_state) .and. (order_date > var->which_date)

To Specify that Alpha Anywhere should prompt for parameters at run-time:

  1. Check the Prompt for Parameters at run-time box.

  2. Click the Define Parameters button to define the parameters.

As an alternative to clicking the "Prompt for Parameters at run-time" box, you can define a prior action in your script that will define variable values. For example, the "Display an Xdialog Box" action will prompt the user for values. The variables created by this action can be used in your filter and order expressions in the same way that you use parameters. If you use the "Display an Xdialog Box" action to prompt the user for variable values, you must specify Shared or Global as the scope of the variables defined by the dialog box.